Garden Battle


The Project

This project was my Final Degree Work. The game is a battle simulator, where 4 different types of insects fight each other in order to destroy their bases for winning the game. Each one has its own strategy in order to kill the rest. The player can choose how many species want of each type, with a maximum of 100 units. After selecting the units, the bases of each one are randomly generated as well as the terrain. Then the insects can try to kill each other.

The length of the project was 4 months and was successfully completed.


Technical Details

AI System

The most important part of this game is the AI. I developed a hybrid system between Hierarchical State Machines Hierarchical State Machines and Behavior Trees.

The state of the unit is selected through the state machine, and, the actions and the transitions are handled by the behavior trees.

Since it is a Hierarchical State Machine, there are only a few transitions that the system has to check, and the general behavior is well divided in sub behaviors.

Example of a State Machine that you can make with the system I created. The state with a yellow border is the current one, and the red arrows are the transitions that must be checked.

The State Machine of the Ant.

The behavior trees for checking the transitions between states.

Terrain Generation

The terrain of each game is procedurally generated. In addition, the bases of each insect are randomly placed along the map, and the units adapt to the surface for spawning correctly inside the garden.

Here are some examples of different terrains generated:

Here is the distribution of the units depending on the terrain:


Extra images

Battle between an ant and a wasp

Battle with 20 units of each insect (seen from a top view with icons)

Battle with 50 units of each insect (seen from a top view with icons)

Battle with 100 units of each insect (seen from a top view with icons)